<!--  -->
<template>
  <div>
    <el-tree
      :data="dataList"
      node-key="catId"
      :props="defaultProps"
      :default-expanded-keys="defaultExpandedKeys"
      :auto-expand-parent="true"
      @node-click="nodeClick"
    >
    </el-tree>
  </div>
</template>

<script>
export default {
  data() {
    return {
      dataList: [],
      defaultExpandedKeys: [],
      dialogVisible: false,
      defaultProps: {
        children: "children",
        label: "name",
      },
    };
  },
  methods: {
    // 查询菜单树
    getTreeMenu() {
      this.$http({
        url: this.$http.adornUrl("/sky-mall-product/pmsCategory/list/tree"),
        method: "get",
      }).then(({ data }) => {
        if (data && data.code === 0) {
          this.dataList = data.data;
        }
      });
    },
    nodeClick(data,node,component){
      this.$emit("tree-node-click",data,node)
    }
  },
  created() {
    this.getTreeMenu();
  },
};
</script>
